<?php include __DIR__.'/../public/header_m.php';?>
<div class="container mw-700px">
  <div id="titlebar">
    <div class="heading">
      <span class="prefix"><i class="icon-user"></i></span>
      <strong><small class="text-muted"><i class="icon-plus"></i></small> 添加用户</strong>
    </div>
  </div>
  <form id="dataform" target="hiddenwin" method="post" action="<?php echo $formUrl; ?>" class="form-condensed mw-700px">
    <?php if(isset($id)): ?>
        <input name="data[id]" type="hidden" value="<?php echo $id;?>" />
    <?php endif; ?>
    <table align="center" class="table table-form"> 
      <tbody>
      <tr>
        <th>用户名</th>
        <td><div class="required required-wrapper"></div><input type="text" autocomplete="off" class="form-control" value="<?php if(isset($userInfo['name'])) echo $userInfo['name']; ?>" id="account" name="data[name]" placeholder="英文、数字和下划线的组合，三位以上">
        </td>
      </tr>
      <tr>
        <th>真实姓名</th>
        <td><div class="required required-wrapper"></div><input type="text" class="form-control" value="<?php if(isset($userInfo['realname'])) echo $userInfo['realname']; ?>" id="realname" name="data[realname]">
        </td>
      </tr>
      <tr>
        <th>密码</th>
        <td><div class="required required-wrapper"></div><input type="password" autocomplete="off" class="form-control" value="" id="password1" name="data[password]" placeholder="六位以上">
        </td>
      </tr>
      <tr>
        <th>请重复密码</th>
        <td><div class="required required-wrapper"></div><input type="password" autocomplete="off" class="form-control" value="" id="password2" name="data[password_confirmation]">
        </td>
      </tr>
      <tr>
        <th>用户组</th>
        <td>
            <div class="required required-wrapper"></div>
            <select class="form-control" id="role" name="data[group_id]">
                <option value="0">请选择用户组</option>
                <?php foreach($groupList as $key => $value): ?>
                    <option value="<?php echo $value['id'];?>" <?php if(isset($userInfo['group_id']) && $userInfo['group_id'] == $value['id']) echo 'selected'; ?>><?php echo $value['group_name'];?></option>
                <?php endforeach; ?>
            </select>
        </td>
        <td width="150"></td>
      </tr>
      
      <tr>
        <th>电话</th>
        <td><input type="text" class="form-control" value="<?php if(isset($userInfo['mobile'])) echo $userInfo['mobile']; ?>" id="mobile" name="data[mobile]" placeholder="手机号码">
        </td>
      </tr>
      
      <tr>
        <th>性别</th>
        <td><label class="radio-inline"><input type="radio" id="genderm" checked="checked" value="m" name="data[sex]"> 男</label><label class="radio-inline"><input type="radio" id="genderf" value="f" name="sex"> 女</label></td>
      </tr>

      <tr><th></th><td> <button class="btn btn-submit btn-primary" id="submit" data-submitting="提交中..." type="submit">保存</button><a class="btn btn-back" href="javascript:history.go(-1);">返回</a></td></tr>
    </tbody></table>
  </form>
</div>
<?php include __DIR__.'/../public/footer_m.php';?>